/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"4128473D-F1FC-45BA-89A4-7731D04BA825",variableType:4}
 */
var fCodProveedor = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"02A2A080-4DFC-4251-B344-F7A49EDC701B",variableType:4}
 */
var fEstado = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"C5A25388-83B6-4A6E-AD8F-24C1A2F98728",variableType:4}
 */
var fProveedor = null;

/**
 * @type {Date}
 *
 * @properties={typeid:35,uuid:"F6C97BE4-0B86-4108-AFA5-A2EC7D65705A",variableType:93}
 */
var fFechaHasta = null;

/**
 * @type {Date}
 *
 * @properties={typeid:35,uuid:"2A4BC228-4606-4A4C-BD13-B22914334B2A",variableType:93}
 */
var fFechaDesde = null;

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"F4670D67-0E49-4431-9A9A-E4716B881C43"}
 */
function iraDtl(event) {
	//forms.oc_cabecera_dtl_ind.controller.show()
	forms.oc_cabecera_dtl_ind.controller.loadRecords(oc_cabecera_id)
	globals.mostrarForm('oc_cabecera_dtl_ind')
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"B16BC84C-E1F7-42C1-9FB6-9FE9C4655294"}
 * @AllowToRunInFind
 */
function busca(event) {
	controller.find()
	
	if (fFechaDesde != null && fFechaHasta != null)
	{
		var rango = utils.dateFormat(fFechaDesde,'dd-MM-yyyy') + '...' + utils.dateFormat(fFechaHasta, 'dd-MM-yyyy')
		fecha = '#' + rango + '|dd-MM-yyyy'
	}
	proveedor_id = fProveedor
	oc_estado = fEstado
	
	if (controller.search() == 0)
		globals.DIALOGS.showInfoDialog('Aviso','No hay resultados','OK') // 23/01/2014
	else
		controller.sort('fecha desc')
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"E0A6DACB-5F39-49D6-B843-8C6AD00A66DF"}
 */
function fechasNulas(event) {
	fFechaDesde = null
	fFechaHasta = null
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"A1488F95-C0B2-49D4-B780-0026FE49A95C"}
 */
function proveNulo(event) {
	fProveedor = null
}

/**
 * Callback method for when form is shown.
 *
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"9D566D37-E4FD-4E25-A5A9-8852DD3684A2"}
 */
function onShow(firstShow, event) {
	controller.sort('oc_cabecera_id desc')
	
	fFechaDesde = globals.gFechaDesde
	fFechaHasta = globals.gFechaHasta
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"52B6EE19-CD3A-44FC-9EE0-87DD57109B03"}
 * @AllowToRunInFind
 */
function todos(event) {
	controller.loadAllRecords()
	controller.sort('fecha desc')
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"F22072DD-1E13-492F-BE48-70EAD3EB1358"}
 */
function estadoNulo(event) {
	fEstado = null
}
